package com.itheima.sys.client;

import com.itheima.common.vo.Result;
import com.itheima.sys.dto.CompanyUserDTO;
import com.itheima.sys.dto.SysUserDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "sys-service", contextId = "sysUser")
public interface UserClient {

    /**
     * 查询到用户
     * @param username 手机号/用户名
     * @return
     */
    @GetMapping("/user/query")
    public Result<SysUserDTO> querUser(@RequestParam("username") String username);

    /**
     * 根据用户ID，企业ID 查询企业员工记录
     * @param userId 系统用户ID
     * @param companyId 企业ID
     * @return
     */
    @GetMapping("/companyUser/query")
    public Result<List<CompanyUserDTO>> queryCompanyUserById(
            @RequestParam(value = "id", required = false) Long userId,
            @RequestParam(value = "companyId", required = false) Long companyId
    );


}
